<?php

namespace App\Services\Passport;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;

class PassportServiceProvider extends ServiceProvider
{
    protected $defer = true;

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        $this->mergeConfigFrom(__DIR__.'/config/config.php', 'chuwo.passport');

        $this->app->singleton('chuwo.passport.client', function($app){
            return new Client($app, config("chuwo.passport"));
        });
    }

    protected function config($key, $default = null)
    {
        return config("chuwo.passport.$key", $default);
    }

    public function provides()
    {
        return ['chuwo.passport.client'];
    }
}
